package 华为OD机试真题2023.基础题;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class HJ05_单词倒序 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(new File("src/main/java/华为OD机试真题2023/基础题/input/05.txt"));
        String[] sArray = in.nextLine().split(" ");
        for (int i = 0; i < sArray.length; i++) {
            int len = sArray[i].length();
            if (i != sArray.length - 1) {
                char a = sArray[i].charAt(len - 1);
                if (a == ',' || a == '?') {
                    System.out.print(new StringBuffer(sArray[i].substring(0, len - 1)).reverse().toString() + a + ' ');
                } else {
                    System.out.print(new StringBuffer(sArray[i].substring(0, len)).reverse().toString() + ' ');
                }
            } else {
                System.out.print(new StringBuffer(sArray[i].substring(0, len - 1)).reverse().toString() + ".");
            }
        }
    }
}
